package com.bidevalution.business.impl;

import com.bidevalution.business.service.LogService;
import com.bidevalution.dao.entity.LogInfo;
import com.bidevalution.dao.mapper.LogMapper;
import com.qtp.core.model.Paging;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.Map;

/**
 * @Description 日志接口实现类
 * @Date        2020-02-10 9:13
 * @Author      lhl
 */
@Log4j2
@Service
public class LogServiceImpl implements LogService {

    @Autowired(required = false)
    LogMapper logMapper;

    @Override
    public int insertLogInfo(LogInfo logInfo) {
        return logMapper.insertLogInfo(logInfo);
    }

    @Override
    public Paging<LogInfo> getLogInfoPaging(Map<String, Object> params) {
        long logInfoCount = logMapper.getLogInfoCount(params);
        if (logInfoCount == 0){
            return new Paging(0L,new ArrayList());
        }else {
            return new Paging(logInfoCount,logMapper.getLogInfoList(params));
        }
    }
}
